import request from '@/utils/request'

export const EXPORT_URL = "system/new/exportrules";

// 查询列表
export function listRule(query) {
  console.log('listRule', query)
  return request({
    url: '/system/eaCarBillingRules/list',
    method: 'get',
    params: query
  })
}

// 查询详细
export function getRule(id) {
  return request({
    url: `/system/eaCarBillingRules/${id}`,
    method: 'get'
  })
}

// 新增
export function addRule(data) {
  return request({
    url: '/system/eaCarBillingRules',
    method: 'post',
    data: data
  })
}

// 修改
export function updateRule(data) {
  return request({
    url: '/system/eaCarBillingRules',
    method: 'put',
    data: data
  })
}

// 删除
export function delRule(roleId) {
  return request({
    url: `/system/eaCarBillingRules/${roleId}`,
    method: 'delete'
  })
}

// 获取所有运营商
export function getAllOperator() {
  return request({
    url: '/system/eaCarOperatorInfo/optionSelect',
    method: 'get'
  })
}

// 复制计费规则
export function copyRule(id) {
  return request({
    url: `/system/eaCarBillingRules/copy/${id}`,
    method: 'post'
  })
}

// 更新充电站计费规则状态
export function changeStatus(data) {
  return request({
    url: '/system/eaCarBillingRules/changeStatus',
    method: 'put',
    data: data
  })
}
